home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / bbsutil / dlx70bbs.zip / DLX70SRC.ZIP / NEWASM.ASM < prev    next >
Assembly Source File  |  1994-01-19  |  4KB  |  118 lines

  1. ;=============================================================================
  2.     Title    New MASM Functions for DLX
  3. ;=============================================================================
  4.  
  5. ; DLX Bulletin Board System V7.0
  6. ;
  7. ; FREEWARE NOTICE
  8. ;
  9. ; DLX V7.0 is placed in the public domain by its author, Richard Gillmann.
  10. ; Anyone who wishes to may run the program, copy it, or modify it for
  11. ; any purpose, including commercial gain.
  12. ;
  13.  
  14. .model    medium,pascal
  15.  
  16. .code
  17. ;-----------------------------------------------------------------------------
  18. ; function uc(chara : char) : char;
  19. ;
  20. ; Force a character to upper case
  21. ;-----------------------------------------------------------------------------
  22. uc    proc    chara:byte
  23.     mov    al,chara        ; the character
  24.     cmp    al,'a'            ; range check
  25.     jb    @F
  26.     cmp    al,'z'
  27.     ja    @F
  28.     sub    al,'a'-'A'        ; convert lower case to upper
  29. @@:    ret                ; done
  30. uc    endp
  31.  
  32. ;-----------------------------------------------------------------------------
  33. ; function lc(chara : char) : char;
  34. ;
  35. ; Force a character to lower case
  36. ;-----------------------------------------------------------------------------
  37. lc    proc    chara:byte
  38.     mov    al,chara        ; the character
  39.     cmp    al,'A'            ; range check
  40.     jb    @F
  41.     cmp    al,'Z'
  42.     ja    @F
  43.     add    al,'a'-'A'        ; convert lower case to upper
  44. @@:    ret                ; done
  45. lc    endp
  46.  
  47. ;-----------------------------------------------------------------------------
  48. ; procedure ucs(consts s1 : lstring; consts s2 : lstring);
  49. ;
  50. ; Copy upper case version of s1 to s2
  51. ;-----------------------------------------------------------------------------
  52. ucs    proc    uses ds, maxlen1:byte, s1:dword, maxlen2:byte, s2:dword
  53.     cld                ; forward direction
  54.     lds    si,s1            ; get ptr to s1
  55.     les    di,s2            ; get ptr to s2
  56.     lodsb                ; s1.len
  57.     mov    cl,al            ; to CL
  58.     cmp    cl,maxlen2        ; greater than UPPER(s2)?
  59.     jbe    @F            ; jump if not
  60.     mov    cl,maxlen2        ; limit if so
  61. @@:    stosb                ; set s2.len
  62.     xor    ch,ch            ; #characters to copy
  63.     jcxz    udone            ; done if none to copy
  64. ucloop:    lodsb                ; get next character from s1
  65.     cmp    al,'a'            ; range check
  66.     jb    @F
  67.     cmp    al,'z'
  68.     ja    @F
  69.     sub    al,'a'-'A'        ; convert lower case to upper
  70. @@:    stosb                ; store it in s2
  71.     loop    ucloop            ; loop back for more
  72. udone:    ret                ; exit
  73. ucs    endp
  74.  
  75. ;-----------------------------------------------------------------------------
  76. ; procedure lcs(consts s1 : lstring; consts s2 : lstring);
  77. ;
  78. ; Copy lower case version of s1 to s2
  79. ;-----------------------------------------------------------------------------
  80. lcs    proc    uses ds, maxlen1:byte, s1:dword, maxlen2:byte, s2:dword
  81.     cld                ; forward direction
  82.     lds    si,s1            ; get ptr to s1
  83.     les    di,s2            ; get ptr to s2
  84.     lodsb                ; s1.len
  85.     mov    cl,al            ; to CL
  86.     cmp    cl,maxlen2        ; greater than UPPER(s2)?
  87.     jbe    @F            ; jump if not
  88.     mov    cl,maxlen2        ; limit if so
  89. @@:    stosb                ; set s2.len
  90.     xor    ch,ch            ; #characters to copy
  91.     jcxz    ldone            ; done if none to copy
  92. lcloop:    lodsb                ; get next character from s1
  93.     cmp    al,'A'            ; range check
  94.     jb    @F
  95.     cmp    al,'Z'
  96.     ja    @F
  97.     add    al,'a'-'A'        ; convert upper case to lower
  98. @@:    stosb                ; store it in s2
  99.     loop    lcloop            ; loop back for more
  100. ldone:    ret                ; exit
  101. lcs    endp
  102.  
  103. ;-----------------------------------------------------------------------------
  104. ; procedure lseek(handle : integer; newpos : integer4);
  105. ;
  106. ; Move file pointer (zero origin)
  107. ;-----------------------------------------------------------------------------
  108. lseek    proc    handle:word, newposhi:word, newposlo:word
  109.     mov    bx,handle        ; file handle
  110.     mov    cx,newposhi        ; hiword(fileptr)
  111.     mov    dx,newposlo        ; loword(fileptr)
  112.     mov    al,0            ; relative to beginning of the file
  113.     mov    ah,42h            ; lseek
  114.     int    21h            ; dos 2 function
  115.     ret                ; done
  116. lseek    endp
  117.     end
  118.